<?php

namespace App\Ability;

/**
 * 对象可填充
 */
trait Fillable
{
    /**
     * 用参数填充对象
     * @param array $attributes
     */
    public function fill(array $attributes = [])
    {
        foreach ($attributes as $attribute => $value) {
            property_exists($this,$attribute) && $this->{$attribute} = $value ;
        }
    }
}